{include file="public/layout"/}
<body data-type="generalComponents">
<div class="tpl-content-wrapper">
    <ol class="am-breadcrumb">
        <li><a href="javascript:void(0)" onclick="javascript:parent.openItem('welcome|Index');" class="am-icon-home">首页</a></li>
        <li class="am-active">微信</li>
        <li>公众号配置</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="tpl-block ">
            <div class="am-g tpl-amazeui-form">
                <div class="am-u-sm-12 am-u-md-9">
                    <form class="am-form am-form-horizontal js-ajax-form" action="{:url('wechat/setting')}" method="post" multipart/form-data>
                        <div class="am-form-group">
                            <label for="user-name" class="am-u-sm-4 am-form-label">URL(服务器地址)</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" value="{$apiurl}" id="user-name" class="am-input-sm" disabled>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="token" class="am-u-sm-4 am-form-label">Token</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="w_token" value="{$wechat.w_token}" id="token" class="required am-input-sm">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="wx-name" class="am-u-sm-4 am-form-label">公众号名称</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="wxname" value="{$wechat.wxname}" id="wx-name" class="required am-input-sm">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="wx-id" class="am-u-sm-4 am-form-label">公众号原始id</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="wxid" value="{$wechat.wxid}" id="wx-id" class="required am-input-sm">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="weixin" class="am-u-sm-4 am-form-label">微信号</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="weixin" value="{$wechat.weixin}" id="weixin" class="required am-input-sm">
                            </div>
                        </div>

                        <div class="am-form-group">
                            <label class="am-u-sm-4 am-form-label">头像地址</label>
                            <div class="am-u-sm-3 am-form-file" style="float: left">
                                <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                    <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
                                <input id="doc-form-file" type="file" name="headerpic" value=""><div id="file-list"></div>
                            </div>
                            <div class="am-u-sm-2 am-form-file" style="float: left">
                                <span class="show">
                                  <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$wechat.headerpic}">
                                    <i id="img_i" class="am-icon-picture-o" onmouseover="layer.tips('<img src={$wechat.headerpic}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                                  </a>
                              </span>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="appid" class="am-u-sm-4 am-form-label">AppID</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="appid" value="{$wechat.appid}" id="appid" class="required am-input-sm">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="AppSecret" class="am-u-sm-4 am-form-label">AppSecret</label>
                            <div class="am-u-sm-4" style="float: left">
                                <input type="text" name="appsecret" value="{$wechat.appsecret}" id="AppSecret" class="required am-input-sm">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-4 am-form-label">二维码</label>
                            <div class="am-u-sm-3 am-form-file" style="float: left">
                                <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                    <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
                                <input id="doc-form-file1" type="file" name="qr"><div id="file-list1"></div>
                            </div>
                            <div class="am-u-sm-2 am-form-file" style="float: left">
                                <span class="show">
                                      <a id="img_a2" target="_blank" class="nyroModal" rel="gal" href="{$wechat.qr}">
                                        <i id="img_i2" class="am-icon-picture-o" onmouseover="layer.tips('<img src={$wechat.qr}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                                      </a>
                                  </span>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-4 am-form-label" for="doc-select-1">微信号类型</label>
                            <div class="am-u-sm-2" style="float: left">
                                <select id="doc-select-1" name="type">
                                    <option value="1" {if condition="$wechat['type'] eq 1"}selected{/if}>订阅号</option>
                                    <option value="2" {if condition="$wechat['type'] eq 2"}selected{/if}>认证订阅号</option>
                                    <option value="3" {if condition="$wechat['type'] eq 3"}selected{/if}>服务号</option>
                                    <option value="4" {if condition="$wechat['type'] eq 4"}selected{/if}>认证服务号</option>
                                </select>
                                <span class="am-form-caret"></span>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-4 am-form-label">微信接入状态</label>
                            <div class="am-u-sm-4" style="float: left">
                                <label class="am-radio-inline">
                                    <input type="radio"  value="0" name="wait_access" {if condition="$wechat['wait_access'] eq 0"}checked="checked"{/if}> 等待接入
                                </label>
                                <label class="am-radio-inline">
                                    <input type="radio" value="1" name="wait_access" {if condition="$wechat['wait_access'] eq 1"}checked="checked"{/if}> 已接入
                                </label>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$wechat.id}">
                        <div class="am-form-group">
                            <div class="am-u-sm-9 am-u-sm-push-3">
                                <button type="submit" class="am-btn am-btn-primary js-ajax-submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN__/js/admin.js"></script>
<script>
    $(function() {
        $('#doc-form-file').on('change', function() {
            var fileNames = '';
            $.each(this.files, function() {
                fileNames += '<span class="am-badge">' + this.name + '</span> ';
            });
            $('#file-list').html(fileNames);
        });
        $('#doc-form-file1').on('change', function() {
            var fileNames = '';
            $.each(this.files, function() {
                fileNames += '<span class="am-badge">' + this.name + '</span> ';
            });
            $('#file-list1').html(fileNames);
        });
    });
</script>
</body>
</html>